﻿@if (ViewData.TemplateInfo.TemplateDepth > 4) { 
    @ViewData.ModelMetadata.SimpleDisplayText
} else {
    <table class="editor-table">
    @foreach (var prop in ViewData.ModelMetadata.Properties.Where(pm => pm.ShowForEdit && !ViewData.TemplateInfo.Visited(pm))) { 
        if (prop.HideSurroundingHtml) { 
            @Html.Editor(prop.PropertyName) 
        } else { 
            <tr>
                <td>
                    <div class="editor-label" >
                        @if (prop.IsRequired)
                        {
                            <b>@Html.Label(prop.PropertyName)
                            </b>
                        }
                        else
                        {   
                            @Html.Label(prop.PropertyName)
                        }
                    </div>
                </td>
                <td>
                    <div class="editor-field">
                        @if(prop.IsReadOnly) { 
                            @Html.Display(prop.PropertyName) 
                            @Html.Hidden(prop.PropertyName)
                        }else{ 
                            @Html.Editor(prop.PropertyName) 
                        }
                        @Html.ValidationMessage(prop.PropertyName, "*")
                    </div>
                </td>
            </tr>
        }
    } 
    </table>
}